/// @tags: SA SuffixArray
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>

int const N = 5e5 + 5;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

int n, m = 65;
int rk[N << 1], sa[N << 1], tmp[N << 1], cnt[N << 1];
char str[N << 1];

inline char readchar() {
  char ch = getchar();
  while (!isalpha(ch)) ch = getchar();
  return ch;
}

inline void sort() {
  memset(cnt, 0, sizeof(int) * (m + 1));
  for (int i = 1; i <= n; ++i) ++cnt[rk[i]];
  for (int i = 1; i <= m; ++i) cnt[i] += cnt[i - 1];
  for (int i = n; i; --i) sa[cnt[rk[tmp[i]]]--] = tmp[i];
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("P2870 [USACO07DEC]Best Cow Line G.in", "r", stdin);
  freopen("P2870 [USACO07DEC]Best Cow Line G.out", "w", stdout);
#endif
#endif

  read(n);
  for (int i = 1; i <= n; ++i) str[n * 2 + 2 - i] = str[i] = readchar();
  str[n + 1] = '|';
  n = n * 2 + 1;
  for (int i = 1; i <= n; ++i) rk[i] = str[i] - 'A' + 1, tmp[i] = i;
  sort();
  for (int l = 1, p = 0; p < n; l <<= 1, m = p) {
    p = 0;
    for (int i = n - l + 1; i <= n; ++i) tmp[++p] = i;
    for (int i = 1; i <= n; ++i)
      if (sa[i] > l) tmp[++p] = sa[i] - l;
    sort();
    memcpy(tmp, rk, sizeof(tmp));
    rk[sa[1]] = p = 1;
    for (int i = 2; i <= n; ++i) {
      rk[sa[i]] = (tmp[sa[i]] == tmp[sa[i - 1]] && tmp[sa[i] + l] == tmp[sa[i - 1] + l])
                      ? p
                      : ++p;
    }
  }
  int l = 1, r = (n - 1) >> 1, len = 0;
  while (l <= r) {
    putchar(rk[l] < rk[n - r + 1] ? str[l++] : str[r--]);
    if ((++len) % 80 == 0) putchar('\n');
  }
  return 0;
}